﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace RFID测试软件.ViewModel
{
    public class TestViewModel : Notify
    {
        int _AllCount;
        public int AllCount
        {
            get { return _AllCount; }
            set { _AllCount = value; RaisePropertyChanged("AllCount"); }
        }
        int _IngCount;
        public int IngCount
        {
            get { return _IngCount; }
            set { _IngCount = value; RaisePropertyChanged("IngCount"); }
        }
        int _PassCount;
        public int PassCount
        {
            get { return _PassCount; }
            set { _PassCount = value; RaisePropertyChanged("PassCount"); }
        }
        int _FailCount;
        public int FailCount
        {
            get { return _FailCount; }
            set { _FailCount = value; RaisePropertyChanged("FailCount"); }
        }
        private ObservableCollection<Item> _MacItems = new ObservableCollection<Item>() { };
        public ObservableCollection<Item> MacItems
        {
            get => _MacItems;
            set { _MacItems = value; RaisePropertyChanged("MacItems"); }
        }
        public class Item : Notify
        {
            int _id;
            public int id
            {
                get { return _id; }
                set { _id = value; }
            }
            string _Mac;

            public string Mac
            {
                get { return _Mac; }
                set { _Mac = value; }
            }
            string _Read;

            public string Read
            {
                get { return _Read; }
                set { _Read = value; RaisePropertyChanged("Read"); }
            }
            string _Write;
            public string Write
            {
                get { return _Write; }
                set { _Write = value; RaisePropertyChanged("Write"); }
            }

            string _Light;

            public string Light
            {
                get { return _Light; }
                set { _Light = value; RaisePropertyChanged("Light"); }
            }

            double _ItemHeight = 40;
            public double ItemHeight
            {
                get { return _ItemHeight; }
                set { _ItemHeight = value; RaisePropertyChanged("ItemHeight"); }
            }
            SolidColorBrush _BackColor = Brushes.LightGray;
            public SolidColorBrush BackColor
            {
                get { return _BackColor; }
                set { _BackColor = value; RaisePropertyChanged("BackColor"); }
            }
        }
        public class Notify : INotifyPropertyChanged
        {
            public event PropertyChangedEventHandler PropertyChanged;
            protected virtual void RaisePropertyChanged(string propertyname)
            {
                this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));
            }
        }
    }
}
